<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_CSS选择器</title>
    <style>
        h4{
            color: red;
        }
        #d1{
            color: blue;
            width:100px;
            height:100px;
            background-color: pink;
            border:5px solid red;
        }
        .msg{
            color:white;
            border:3px solid black;
        }
        .error{
            background-color: red;
        }
        .success{
            background-color: green;
        }

        a:link{/*选中超链接未被访问过的状态*/
            color:gray;
        }
        a:visited{/*选中超链接已经被访问过的状态*/
            color:green;
        }
        a:hover{/*选中元素被悬停时的状态*/
            color:orange;
        }
        a:active{/*选中元素被激活时的状态*/
            color:red;
        }
        #d1:hover{
            background-color:lightblue;
        }
        #d2 span{
            background-color:yellow;
        }
        #d2>div>p>span{
            color:red;
        }
        h4,#d2,.error{
            border:3px solid cyan;
        }
        *{
            font-style:italic;
        }
    </style>
</head>
<body>
    <div id="d1">我是div</div>
    <div>我是div</div>
    <p>我是段落</p>
    <h4>我是标题</h4>
    <h4>我是标题</h4>
    <hr>
    <span class="error msg">用户名被占用</span>
    <span class="error msg">两次密码不一致</span>
    <span class="error msg">手机号格式不正确</span>
    <br></br>
    <span class="success msg">有效邮箱</span>
    <span class="success msg">有效密码</span>
    <span class="success msg">有效年龄</span>
    <hr>
    <a href="https://www.baidu.com">超链接1</a>
    <a href="abc">超链接2</a>
    <hr>
    <div id="d2">
        <span>111</span>
        <div>
            <span>222</span>
            <p>测试文字</p>
            <p>测试<span>333</span>文字</p>
        </div>
        <span>444</span>
    </div>
</body>
</html>